# Sum up new wind farm capacity in each county each year during 2001-2011.
# Input: txwind.csv

BEGIN {
  FS = ","
  OFS = ","
}

{
  if (FNR == 1)
    next
  county = substr($1,2)
  year = $8
  windcap[county,year] = windcap[county,year] + $3
  windfarmcount[county,year] ++

}

END {
  for (county_year in windcap) {
    split(county_year, cy, SUBSEP)
    print cy[1], cy[2]-1, windfarmcount[county_year], windcap[county_year]
  }
}

